package com.qidianit.task.util.pojo;

import com.qidianit.task.util.Constant;

/**
 * @Author hitsune
 * @Company kafu chino
 * @Description
 * @Time 2024/9/4 下午 2:42
 */
public class QdResult {
    private Integer code;
    private String msg;
    private Object data;
    // 为了方便获取这个类对象，我们添加一些获取这类对象的方法
    public QdResult(Integer code, String msg, Object data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    // 静态方法获取
    public static QdResult success(){
        return new QdResult(Constant.RESPONSE_STATUS_OK,"OK",null);
    }
    public static QdResult success(Integer code){
        return new QdResult(code,"OK",null);
    }
    public static QdResult success(Integer code,String msg){
        return new QdResult(code,msg,null);
    }
    public static QdResult success(Object data){
        return new QdResult(Constant.RESPONSE_STATUS_OK,"OK",data);
    }

    public static QdResult error(){
        return new QdResult(Constant.RESPONSE_STATUS_ERROR,"ERROR",null);
    }
    public static QdResult error(Integer code){
        return new QdResult(code,"ERROR",null);
    }
    public static QdResult error(Integer code,String msg){
        return new QdResult(code,msg,null);
    }
    public static QdResult error(Object data){
        return new QdResult(Constant.RESPONSE_STATUS_ERROR,"OK",data);
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
